package com.itheima.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author itheima
 * @Date 2022/4/27 11:24
 * HelloController: 专门来处理请求
 * MVC=Model+View+Controller
 * @RequestMapping("/hello142")作用：在方法或者类上加上该注解用来标记该controller类能够处理的url的请求
 */
@Controller
public class HelloController {

    /**
     * 当请求：http://localhost:8080/hello
     *
     * @return
     */
    @RequestMapping("/hello")
    public String say(Model model) {
        //Model: request域对象
        model.addAttribute("name", "hello  springmvc!");
        //view: 逻辑视图（页面）名称
        int i = 1 / 0;
        return "success";
    }

}
